Here’s how to use xlsmove()
function.
Description:
Move a worksheet in an
Excel object.
Syntax:
xo.xlsmove (s,s’;xo’)
Note:
The function moves a
worksheet named s in Excel object xo to another Excel object xo’and rename it s'.
When xo’ is absent, the
function renames worksheet s in Excel object xo s'. If parameter s' is also absent at
the same time, just delete worksheet s.
When parameter xo’ is present but
parameter s' is absent, worksheet s will continue to use the current
name.
Parameter:
xo
|
An Excel object retrieved
through non-@r/@w method.
|
s
|
Sheet name in Excel
object xo.
|
s'
|
Sheet name.
|
xo’
|
Excel object.
|
Option:
Return value:
None
Example:
|
A
|
|
1
|
=file("x1.xlsx")
|
Read x1.xlsx and
return an Excel object:
|
2
|
=file("xx.xlsx")
|
Read xx.xlsx and
return an Excel object:
|
3
|
=A1.xlsopen()
|
Read data from x1.xlsx and
return an Excel file object:
|
4
|
=A2.xlsopen()
|
Read data from xx.xlsx and
return an Excel file object:
|
5
|
=A3.xlsmove("s1","sh1";A4)
|
Move sheet s1 in x1.xlsx
to xx.xlsx and rename it sh1; there is also sheet s2 in x1.xlsx:
xx.xlsx has sheet1 and sheet sh1:
|
6
|
=A3.xlsmove@c("s2","sh2";A4)
|
Copy sheet s1 in x1.xlsx
to xx.xlsx and rename it sh2; now x1.xlsx also has sheet s2:
xx.xlsx has sheet1, sheet sh1 and sheet sh2:
|
7
|
=A1.xlsmove("s2","st2")
|
As parameter xo’ is absent,
rename sheet s2 in x1.xlsx st2; below is structure of x1.xlsx:
|
8
|
=A2.xlsmove("sheet1")
|
As both parameter xo’ and parameter s' are absent,
delete sheet1 in xx.xlsx; below is structure of xx.xlsx:
|
9
|
=A1.xlsmove@c("s2";A2)
|
As only parameter s' is absent,
sheet s still uses its current name; and @ option enables copying sheet st2
in x1.xlsx to xx.xlsx; below is structure of xx.xlsx:
|
10
|
=A1.xlswrite(A3)
|
Save data written to the Excel file.
|
11
|
=A2.xlswrite(A4)
|
Same as above.
|